<?php
require 'digg.class.php';
$digg = new digg();

if(!$forward) $forward = HTTP_REFERER;

if(isset($page)) $page = max(intval($page), 1);
$head['title'] = $LANG['title'].' - '.$SETTING['sitename'];
$head['keywords'] = $LANG['keywords'];
$head['description'] = $LANG['keywords'].' - '.$SETTING['sitename'];

		
switch($action){
	case 'support': 
		$data = $digg->update($keyid, 1); 
		//$data = $digg->update($id, 1); 
		if($data){
			showmessage("操作成功",$forward);
		}
		else{
			showmessage("您已经表过态了",$forward);
		}
	break;
	
	case 'against':
		$data = $digg->update($keyid, 0); 
		if($data){
			showmessage("操作成功",$forward);
		}
		else{
			showmessage("您已经表过态了",$forward);
		}
	break;
	
	default:
		$where = $catname = $caturl = '';
		if($catid && isset($CATEGORY[$catid]))
		{
			$where = " AND c.catid IN(".$CATEGORY[$catid]['arrchildid'].") ";
			$catname = $CATEGORY[$catid]['catname'];
			$caturl = $CATEGORY[$catid]['url'];
		}
		include template('index.html','digg');
	break;
}
?>